import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Admin',
    redirect : '/admin'
    // component: () => import('../views/Admin'),
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  },
  {
    path: '/admin',
    name: 'Admin',
    component:  () => import('../views/Admin'),
    children : [
        {
            path: '',
            component: () => import('../components/admin/User')
        },
        {
            path: 'user',
            component: () => import('../components/admin/User')
        },
        {
            path: 'message',
            component: () => import('../components/admin/Message')
        },
        {
            path: 'messagetype',
            component: () => import('../components/admin/MessageType')
        },
        {
            path: 'office',
            component: () => import('../components/admin/Office')
        },
        {
            path: 'supplies',
            component: () => import('../components/admin/Supplies')
        },

    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
